package org.javaboy.springdoc_demo.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringDocConfig {

    @Bean
    GroupedOpenApi userApi() {
        return GroupedOpenApi.builder()
                .group("用户相关API")
                .pathsToMatch("/user/**")
                .build();
    }

    @Bean
    GroupedOpenApi bookApi() {
        return GroupedOpenApi.builder()
                .group("图书相关API")
                .pathsToMatch("/book/**")
                .build();
    }

    @Bean
    OpenAPI openAPI() {
        return new OpenAPI().info(new Info().title("我的项目文档").description("文档的一些描述信息").version("v1.0").license(new License().name("Apache2.0").url("http://www.baidu.com")));
    }
}
